import './home.html';
import '../../components/items/items.js';
import '../../components/login/login.js';
import '../../components/cards/cards.js';

import { Message } from '../../components/message/message.js'


import { Template } from 'meteor/templating';


Template.App_home.helpers({

  welcome_message(){
    let user = Meteor.user();
    if (user != null) {
      return "欢迎，" + user.username;
    }
    return "登录到您的账号";
  },

  is_logined(){
    if (Meteor.userId() != null) {
      return true;
    }
    return false;
  }

});

Template.App_home.events({
  "click .app-logout"(event, instance){
    Meteor.logout();
    FlowRouter.go('/');
    Message.sendSuccess("您已经成功安全退出！", '')
  }
});
